package com.atguigu.srb.oss.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration //项目启动就会创建该对象
@ConfigurationProperties(prefix = "aliyun.oss")
@Data
public class OssProperties {
    private String endpoint;
    private String accessKeyId;
    private String accessKeySecret;
    private String bucketName;

    public static  String ENDPOINT;
    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String BUCKET_NAME;

    @PostConstruct
    public void init(){
        ENDPOINT = this.endpoint;
        ACCESS_KEY_SECRET = this.accessKeySecret;
        ACCESS_KEY_ID = this.accessKeyId;
        BUCKET_NAME = this.bucketName;
    }
}
